package com.hllxd.hism.star.basic.service.constant.alarm;

/**
 * @description 时间段枚举
 * @auhtor wuguangxi
 * @date 2021/12/31 16:19
 **/
public enum TimePeriodEnum {
    DAY("day", "白天"),
    NIGHT("night", "夜晚"),
    ALL("all", "全天");

    TimePeriodEnum(String code, String name){
        this.code = code;
        this.name = name;
    }

    private final String code;

    private final String name;

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static String getNameByCode(String code){
        for(TimePeriodEnum timePeriodEnum : TimePeriodEnum.values()){
            if(timePeriodEnum.getCode().equals(code)){
                return timePeriodEnum.getName();
            }
        }
        return null;
    }
}
